// --------------------------------------------------------------------------------------------
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
// 
// The contents of this file are subject to the Mozilla Public License Version
// 1.1 (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
// http://www.mozilla.org/MPL/
// 
// Software distributed under the License is distributed on an "AS IS" basis,
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
// for the specific language governing rights and limitations under the
// License.
// 
// <remarks>
// Generated by IDLImporter from file nsICookieManager2.idl
// 
// You should use these interfaces when you access the COM objects defined in the mentioned
// IDL/IDH file.
// </remarks>
// --------------------------------------------------------------------------------------------
namespace Gecko
{
	using System;
	using System.Runtime.InteropServices;
	using System.Runtime.InteropServices.ComTypes;
	using System.Runtime.CompilerServices;
	
	
	/// <summary>
    /// Additions to the frozen nsICookieManager
    /// </summary>
	[ComImport()]
	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
	[Guid("daf0caa7-b431-4b4d-ba51-08c179bb9dfe")]
	public interface nsICookieManager2 : nsICookieManager
	{
		
		/// <summary>
        /// Called to remove all cookies from the cookie list
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		new void RemoveAll();
		
		/// <summary>
        /// Called to enumerate through each cookie in the cookie list.
        /// The objects enumerated over are of type nsICookie
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		new nsISimpleEnumerator GetEnumeratorAttribute();
		
		/// <summary>
        /// Called to remove an individual cookie from the cookie list, specified
        /// by host, name, and path. If the cookie cannot be found, no exception
        /// is thrown. Typically, the arguments to this method will be obtained
        /// directly from the desired nsICookie object.
        ///
        /// @param aHost The host or domain for which the cookie was set. @see
        /// nsICookieManager2::add for a description of acceptable host
        /// strings. If the target cookie is a domain cookie, a leading
        /// dot must be present.
        /// @param aName The name specified in the cookie
        /// @param aPath The path for which the cookie was set
        /// @param aBlocked Indicates if cookies from this host should be permanently blocked
        ///
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		new void Remove([MarshalAs(UnmanagedType.LPStruct)] nsAUTF8StringBase aHost, [MarshalAs(UnmanagedType.LPStruct)] nsACStringBase aName, [MarshalAs(UnmanagedType.LPStruct)] nsAUTF8StringBase aPath, [MarshalAs(UnmanagedType.U1)] bool aBlocked);
		
		/// <summary>
        /// Add a cookie. nsICookieService is the normal way to do this. This
        /// method is something of a backdoor.
        ///
        /// @param aHost
        /// the host or domain for which the cookie is set. presence of a
        /// leading dot indicates a domain cookie; otherwise, the cookie
        /// is treated as a non-domain cookie (see RFC2109). The host string
        /// will be normalized to ASCII or ACE; any trailing dot will be
        /// stripped. To be a domain cookie, the host must have at least two
        /// subdomain parts (e.g. '.foo.com', not '.com'), otherwise an
        /// exception will be thrown. An empty string is acceptable
        /// (e.g. file:// URI's).
        /// @param aPath
        /// path within the domain for which the cookie is valid
        /// @param aName
        /// cookie name
        /// @param aValue
        /// cookie data
        /// @param aIsSecure
        /// true if the cookie should only be sent over a secure connection.
        /// @param aIsHttpOnly
        /// true if the cookie should only be sent to, and can only be
        /// modified by, an http connection.
        /// @param aIsSession
        /// true if the cookie should exist for the current session only.
        /// see aExpiry.
        /// @param aExpiry
        /// expiration date, in seconds since midnight (00:00:00), January 1,
        /// 1970 UTC. note that expiry time will also be honored for session cookies;
        /// in this way, the more restrictive of the two will take effect.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void Add([MarshalAs(UnmanagedType.LPStruct)] nsAUTF8StringBase aHost, [MarshalAs(UnmanagedType.LPStruct)] nsAUTF8StringBase aPath, [MarshalAs(UnmanagedType.LPStruct)] nsACStringBase aName, [MarshalAs(UnmanagedType.LPStruct)] nsACStringBase aValue, [MarshalAs(UnmanagedType.U1)] bool aIsSecure, [MarshalAs(UnmanagedType.U1)] bool aIsHttpOnly, [MarshalAs(UnmanagedType.U1)] bool aIsSession, long aExpiry);
		
		/// <summary>
        /// Find whether a given cookie already exists.
        ///
        /// @param aCookie
        /// the cookie to look for
        ///
        /// @return true if a cookie was found which matches the host, path, and name
        /// fields of aCookie
        /// </summary>
		[return: MarshalAs(UnmanagedType.U1)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		bool CookieExists([MarshalAs(UnmanagedType.Interface)] nsICookie2 aCookie);
		
		/// <summary>
        /// Count how many cookies exist within the base domain of 'aHost'.
        /// Thus, for a host "weather.yahoo.com", the base domain would be "yahoo.com",
        /// and any host or domain cookies for "yahoo.com" and its subdomains would be
        /// counted.
        ///
        /// @param aHost
        /// the host string to search for, e.g. "google.com". this should consist
        /// of only the host portion of a URI. see @add for a description of
        /// acceptable host strings.
        ///
        /// @return the number of cookies found.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		uint CountCookiesFromHost([MarshalAs(UnmanagedType.LPStruct)] nsAUTF8StringBase aHost);
		
		/// <summary>
        /// Returns an enumerator of cookies that exist within the base domain of
        /// 'aHost'. Thus, for a host "weather.yahoo.com", the base domain would be
        /// "yahoo.com", and any host or domain cookies for "yahoo.com" and its
        /// subdomains would be returned.
        ///
        /// @param aHost
        /// the host string to search for, e.g. "google.com". this should consist
        /// of only the host portion of a URI. see @add for a description of
        /// acceptable host strings.
        ///
        /// @return an nsISimpleEnumerator of nsICookie2 objects.
        ///
        /// @see countCookiesFromHost
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsISimpleEnumerator GetCookiesFromHost([MarshalAs(UnmanagedType.LPStruct)] nsAUTF8StringBase aHost);
		
		/// <summary>
        /// Import an old-style cookie file. Imported cookies will be added to the
        /// existing database. If the database contains any cookies the same as those
        /// being imported (i.e. domain, name, and path match), they will be replaced.
        ///
        /// @param aCookieFile the file to import, usually cookies.txt
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void ImportCookies([MarshalAs(UnmanagedType.Interface)] nsIFile aCookieFile);
		
		/// <summary>
        /// Returns an enumerator of all cookies that are related to a specific app.
        ///
        /// If the onlyBrowserELement parameter is set to true, only cookies part of
        /// a browser element inside the app will be returned. If set to false, all
        /// cookies will be returned, regardless of their browserElement flag.
        ///
        /// This method assumes that appId is a valid app id. It should not be a
        /// special value like UNKNOWN_APP_ID or NO_APP_ID.
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsISimpleEnumerator GetCookiesForApp(uint appId, [MarshalAs(UnmanagedType.U1)] bool onlyBrowserElement);
		
		/// <summary>
        /// Remove all the cookies associated with the app with the id aAppId.
        ///
        /// If onlyBrowserElement is set to true, the method will only remove the
        /// cookies marked as part of a browser element inside the app.
        ///
        /// Special app id values are not allowed (NO_APP_ID or UNKNOWN_APP_ID for example).
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void RemoveCookiesForApp(uint appId, [MarshalAs(UnmanagedType.U1)] bool onlyBrowserElement);
	}
}
